-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add bulk finalization #5734
Add bulk finalization #5734
Conversation
dc2d6c9
to
6e78da6
Compare
We're not adding more predicate caching in this release, and this setting makes FormEntryController creation dependent on the current project.
48efb63
to
9d45a71
Compare
@alyblenkin @lognaturel just to clarify: should we mark a form that hasn't need validated yet as "incomplete" or "complete"? I was assuming "incomplete", but wanted to double check. |
Yes, that's what I was thinking. The goal is to give the user error feedback earlier.
And then we need to change the validation button at the end from "check for errors" to "check for completeness" once we decide that this is the language we want to move forward with. |
Good point. Just to be clear, for this PR you'll never actually see "Complete" as there will be no way to see a form that's saved and valid in Drafts. That will come with #5718 (which I'll update for the new design). |
Yes exactly! Sorry I was writing it out more for my own clarity. @lognaturel let me know if you are thinking about it differently. |
That all sounds great to me! "Incomplete" feels like a good choice for "we don't know" because it forces the user to open that submission again and take an explicit action. The worst case with that would be that they get stuck in a loop opening the submission, deciding everything looks good, tapping the back button to exit, again seeing "Incomplete", and repeating. Hopefully at some point they'd try the finalize/send button if their intent is to send. If complete and "we don't know" submissions look the same, then users could assume that a particular draft is done for now and fail to capture important information. That feels worse than the possible annoying loop described above. |
@grzesiek2010 @lognaturel this is ready for another look. The pill/chip doesn't look quite right yet, but @alyblenkin and I discussed this and seeing as a "non-clickable" chip (something that we and it seems the Material 3 website CSS refer to as a "pill") doesn't official exist, we're going to pair on building this out properly a little later. |
import java.util.Date | ||
import java.util.Locale | ||
|
||
object InstanceListItemView { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this is not a custom view but a class that only sets its state?. This is not something we used to do.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I should have left a comment about this. The problem is that it's used by a SimpleCursorAdapter
which does the view inflation itself - I'm trying to make as little changes to existing code as possible to make merging easier later. I didn't want to have to refactor out the cursor, so this was where I ended up. I guess maybe a better approach would be to make this a ViewHolder
that takes a view in the constructor. That would be overkill for now, but would plugin straight to a RecyclerView
when all this gets refactored. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that adding a comment in the class that at some point it should be a custom view as the class name says is ok for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
setUpSubtext(view, instance, context) | ||
|
||
val chip = view.findViewById<TextView>(R.id.chip) | ||
if (chip != null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible that it's null?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah because the adapter sometimes uses a different layout (form_chooser_list_item_multiple_choice.xml
).
disabledCause.text = disabledMessage | ||
|
||
// Material design "disabled" opacity is 38%. | ||
formTitle.alpha = 0.38f |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be good to factor out this constant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this might not even be correct anymore. I'll pull it out as a constant for this file, but don't want to get distracted by restyling the whole list item right now.
@grzesiek2010 @lognaturel I think we should skip QA for this PR as it leaves things in a confusing state (all drafts end up incomplete) and then test everything as part of the PR for #5718. |
I agree with merging this and then doing QA when #5718 is in. I'm seeing the literal string "Success! %d forms finalized". Maybe that's something you intend to come back to once we finalize all language but wanted to flag in case it's unexpected. We'll also need to trigger autosend after bulk finalization completes. That could be tracked and addressed separately. Looks good to me beyond that! |
Fixed! |
Add bulk finalization
Add bulk finalization
Add bulk finalization
Closes #5714
This makes it possible to finalise all forms in "Drafts" without needing to open any of them. There's still a bunch of different cases and kinds of forms we need to handle, and that is all listed in "Follow on work" in the issue (I'll write these up as their own issues).
I've also made a change to our linting here so that
./gradlew checkCode
does not check for hardcoded strings, but that CI does using a different lint command (lintDebug -PlintStrings
). This makes it easier to work on a PR without translated strings and then add them at the end.As this PR adds some strings, we'll need to add them to
master
after we merge. The strings to add are:finalize_all_forms
bulk_finalize_success
bulk_finalize_failure
bulk_finalize_partial_success
incomplete
What has been done to verify that this works as intended?
New and existing tests.
Why is this the best possible solution? Were any other approaches considered?
I mainly follow the approach we're now using for forms of having a data service that accesses repos and then exposing UI state to the Activity/Fragment with a ViewModel. One thing to note is that so that this will be easier to merge in later, I've made as few changes to existing code so there are definitely missed opportunities to share the new code with the existing form loading/saving flows.
How does this change affect users? Describe intentional changes to behavior and behavior that could have accidentally been affected by code changes. In other words, what are the regression risks?
As I said above, I've made as few changes to existing code which should hopefully also lower the risk here. In terms of testing the new functionality: it'd definitely be good to check bulk finalization with as many different kinds of forms as you can think of! The kinds of scenarios that I expect not work are listed in "Follow on work" in the issue, but still feel free to try these out if only to confirm they don't actually work.
Before submitting this PR, please make sure you have:
./gradlew checkAll
and confirmed all checks still pass OR confirm CircleCI build passes and run./gradlew connectedDebugAndroidTest
locally.